package cate.game.play.skill.effect;

import cate.game.attr.FightAttr;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.util.FighterFilter;
import easy.java.dev.note.NoteClass;

@NoteClass("技能结算临时属性")
public class SkillTempAttrHandler {

	/**
	 *
	 * @param effect
	 * @param actor
	 * @param target
	 * @param addToActor 是否加给施法者
	 */
	public static void settle(String code, SkillEffect effect, Fighter actor, Fighter target, boolean addToActor) {
		PlayCfgArgs arg = new PlayCfgArgs(code);
		FightAttr attr = new FightAttr(arg.get("属性"));
		if (FighterFilter.test(arg, actor, target)) {
			if (addToActor) {
				effect.getTargetCtx(target.getPid()).addActorAttr(attr);
			} else {
				effect.getTargetCtx(target.getPid()).addTargetAttr(attr);
			}
		}
	}
}
